import java.util.Arrays;
import java.util.Scanner;

public class test22 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
        }
        System.out.println(IsContinuous(arr));
    }

    public static boolean IsContinuous (int[] numbers) {
        int sum = 0,len = numbers.length,count =0;
        Arrays.sort(numbers);
        for (int i = 0; i < len; i++) {
            if(numbers[i]==0)
                count++;
        }
        for (int i = 1; i < len; i++) {
            if(numbers[i]==numbers[i-1]&&numbers[i-1]!=0)
                return false;
            if(numbers[i-1]!=0)
                sum+=numbers[i]-numbers[i-1]-1;
        }
        return count>=sum;
    }
}
